package es.uc3m.setichat.utils;

import java.security.*;

public class GenerarClaves {
	
	Key privateKey;
	Key publicKey;
	
	public GenerarClaves(){
		try {
			KeyPairGenerator generator = KeyPairGenerator.getInstance("RSA");
			generator.initialize(512, new SecureRandom());
			KeyPair keyPair = generator.generateKeyPair();
			this.privateKey = keyPair.getPrivate();
			this.publicKey = keyPair.getPublic();
			
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		} 
	}
	
	public Key getPrivateKey(){
		return this.privateKey;
	}
	
	public Key getPublicKey(){
		return this.publicKey;
	}
}
